package jetzhu;

import java.util.*;
import java.util.stream.Collectors;

public class Array {
    //字符串转换为整数数组
    private static List<Integer> toIntList(String str) {
        Scanner in = new Scanner(System.in);
        String[] nums = in.nextLine().split(" ");

        in.close();

        //method 1 字符串转换为整形数组，去重。
        ArrayList<Integer> list = Arrays.stream(nums)
                .map(Integer::parseInt)
                .distinct()
                .collect(Collectors.toCollection(ArrayList::new));

        TreeSet<Integer> resSet = new TreeSet<>();
        String s="abc";

        //method 2
        return Arrays.stream(str.split(","))
                .map(Integer::parseInt)
                .collect(Collectors.toList());

    }

    public static void main(String[] args) {

        Integer[] n = {1,2,5,4,1};
        Arrays.sort(n, ((o1, o2) -> o2-o1)); //数组降序排列
        for(int i:n){
            System.out.println(n[i-1]);
        }

        Scanner in=new Scanner(System.in);
        String line = in.nextLine();

        char[] chars = line.toCharArray();  //字符串转换为字节数组
        for(int i=0;i<chars.length;i++){
            System.out.println(chars[i]);
        }

        String str=String.valueOf(chars);  //字节数组转换为字符串
        System.out.println("final String is :"+str);

    }


}
